const Router = require("koa-router")
const Server = require("./server")
const Check = require("./check")

/**
 * 路由对象
 * @type {Router}
 */
const router = new Router({
	prefix: '/baidu'
})

/**
 * 本地图片识别
 */
router.get('/local-text-identify', async function (ctx, next){
  Check.localText(ctx)
	const data = await Server.localText(ctx)
	ctx.sendSuccess(data.words_result)
})

/**
 * 网络图片识别
 */
router.get('/url-text-identify', async function (ctx, next){
  Check.urlText(ctx)
	const data = await Server.urlText(ctx)
	ctx.sendSuccess(data.words_result)
})

module.exports = router
